package oa.core;

import javax.servlet.http.Cookie;

public class MyCookie {
	
	private static Cookie cookie = null;
	
	public static Cookie getInstance(String cookieName, String cookieValue){
		if(cookie == null){
			return new Cookie(cookieName, cookieValue);
		}
		return cookie;
	}
	
	public static void setDomain(String domain){
		if(domain == null){
			MyCookie.cookie.setDomain("");
		}else{
			MyCookie.cookie.setDomain(domain);
		}
	}
	
	public static void setMaxAge(int maxAge){
		//if the set not use cookie
		if(maxAge == 0){
			MyCookie.cookie.setMaxAge(0);
		}else{
			MyCookie.cookie.setMaxAge(Constant.COOKIE_MAX_AGE);
		}
	}
	
}
